package xjh.him.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import com.xjh.him.R;

import java.util.List;

import xjh.him.common.MyBaseAdapter;
import xjh.him.common.MyViewHolder;
import xjh.him.entity.User;
import xjh.him.util.GlideUtil;

public class FriendAdapter extends MyBaseAdapter<User> {
    private List<User> beans;
    private int layoutRes;

    public FriendAdapter(List<User> beans, int layoutRes) {
        super(beans, layoutRes);
        this.beans = beans;
        this.layoutRes = layoutRes;
    }

    @Override
    public void bindView(MyViewHolder holder, User bean) {
        ImageView itemAvatar = holder.getItemView().findViewById(R.id.item_avatar);
        TextView itemName = holder.getItemView().findViewById(R.id.item_name);
        TextView footText = holder.getItemView().findViewById(R.id.item_foot_text);

        GlideUtil.loadImage(holder.getItemView().getContext(), bean.getAvatarUrl(),
                itemAvatar, GlideUtil.defaultRoundedAvatarOpt());
        itemName.setText(bean.getName());
        footText.setText(bean.getSignature());
    }
}
